Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


PreviousPrevious NextNext

~Elizabeth Elgerosonli 15.Dec.03 11:14 AM a Web browser
Applications Development 6.0.2 CF2 iSeries


For deploying multiple databases to many people, I have created a setup database.
This setup database shall create local encrypted replicas of the server databases. As we are currently using R5.0.11 for the clients, I can't make this with the standard Lotus Script when using consistent acl over all replicas.

So I decided to use the notes C - API. My Code works in the following way:
1. create a new local database, which is encrypted.
2. Get the replica Info datastructure from the server replic.
3. Set the retrieved replicainfo data structure to the newly created database.
4. Change the ACL of the Server replic by an agent to use the current user as a person entry.
5. Start the first replication.

The routine works well on the Domino Server R5.0.9a for the ISeries.
After the upgrade to R6.0.2CF2. I have problems. The routine seems to delete documents on the server. In the local replic, the documents are existing. When I delete the replicationhistorie on the local replic. All deleted documents are replicated back to the server.

What am I doing wrong? Or is this a problem with R6.0.CF2?

The pgm code for setting the replica info structure follows:

Const NOTE_CLASS_ICON = &H0010

Type TTimeDate
innards(0 To 1) As Long
End Type

Type TReplicaInfo
ID As TTimeDate
Flags As Long
CutOffIntervall As Long
CutOff As TTimeDate
End Type

Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval dbName As String, hdb As Long ) As Long
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hdb As Long ) As Long
Declare Function W32_NSFDbReplicaInfoGet Lib "nnotes.dll" Alias "NSFDbReplicaInfoGet" (Byval hdb As Long, ReplicaInfo As TReplicaInfo) As Long
Declare Function W32_NSFDbReplicaInfoSet Lib "nnotes.dll" Alias "NSFDbReplicaInfoSet" (Byval hdb As Long, ReplicaInfo As TReplicaInfo) As Long

'Constants for nsfdbcreateExtended and local security

' this are the constants for the db classes

'This are the constants for selectin the documents to replicate.
Const NOTE_CLASS_NONE = &H000&

'This are the possible encryption strength in 'Notes

'Create replic instead of copy

Dim ss As NotesSession
Dim Sdb As String
Dim Tdb As String
Dim hdb As Long
Dim strDbInfo As String * 255
Dim strDBtitle As String * 255
Dim strDBtemplate As String * 255
Dim rc As Long
Dim Force As Integer

Sub CreateLocalEncryptedDB(Byval myId As String)
Dim session As New NotesSession
Dim hDB As Long
Dim ret As Integer
Dim mydb As New NotesDatabase("","")
Dim cdb As Notesdatabase
Dim myDoc As NotesDocument
Dim myReplication As NotesReplication
Dim myLog As KEBSalesLog

Dim S_Db As String
Dim D_Db As String
Dim forceCreation As Integer
Dim ReplicaInfo As TReplicaInfo
Dim ReplicaID As TTimeDate
Dim rc As Long
Dim myNameStr As String

Set cdb = session.currentdatabase
Set myLog = New KEBSalesLog("Lokale Replik: Erzeugung einer lokal verschlüsselten Datenbank")

REM Übergabeparameter nutzen um das ParameterDokument mit dem Namen des Erstellers zu bekommen.
REM Das Feld fl_name beinhaltet den Namen desjenigen, der die Datenbank geöffnet hat.
Set myDoc = cdb.GetDocumentbyId(myId)
myNameStr = myDoc.fl_name(0)

S_DB = cdb.server +"!!" + cdb.filepath
' D_DB = cdb.filename

'Neue Zuweisung des lokalen Datenbanknamens
'/HP 28.11.2003
If Trim(myDoc.fl_folder(0)) = "" Then
D_DB = myDoc.fl_localdata(0) + "\" + cdb.filename
D_DB = myDoc.fl_localdata(0) + "\" + myDoc.fl_folder(0) + "\" + cdb.filename
End If

REM ***W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API***
erzeugt, die zusätzlich verschlüsselt wird.
Print "Bitte warten... lokale Datenbank wird erzeugt!"

REM 0 sollte true sein, oder ???
ForceCreation = 0

'Mit Verschlüsselung

'* Moving the replicainfo structure to the targetdb

'* Retrieve original
rc = W32_NSFDbOpen(S_Db, hDB)
rc = W32_NSFDBReplicaInfoGet(hDB, ReplicaInfo)
rc = W32_NSFDbClose(hDB)

'* Move to the newly created db
rc = W32_NSFDbOpen(D_Db, hDB)
rc = W32_NSFDBReplicaInfoSet(hDB, ReplicaInfo)
rc = W32_NSFDbClose(hDB)

REM ***W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API******W32 API***

'Open local replic
If myDB.Open("", D_DB) Then
Call MyLog.LogAction("Lokale Replik wird zum Replizieren geöffnet!")
Call myLog.LogAction("Lokale Replik konnte nicht geöffnet werden!")
Exit Sub
End If

'Make shure the replication goes over the complete db
'By Setting CutOffDelete to true and finally to false again, the corresponding CutOffDeleteDate
'Is iinitialized to <Space>
Set myReplication = mydb.ReplicationInfo
If myReplication Is Nothing Then Exit Sub

myReplication.CutOffDelete = True
myReplication.CutOffDelete = False

Call myReplication.ClearHistory
Call myReplication.Save

Call myLog.LogAction("Beim replizieren mit dem Server...")

'Replicate the stubs with the original DB on the server
If mydb.replicate(cdb.server) Then
Call myLog.LogAction("Erste Replizierung korrekt beendet!")

'Wenn die Server Datenbank volltextindiziert ist, wird auch die lokale indiziert!
If cdb.IsFTIndexed Then

'Volltextindex wird erzeugt!
Call mydb.UpdateFTIndex(True)

Call myLog.LogAction("Volltextindex wird erzeugt...")
End If

Call myLog.LogAction("Fehler bei der Replizierung!")
Exit Sub
End If

End Sub

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS